home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7187 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Is it possible to have one Makefile for several compilers?
  5. Date: 17 Feb 96 21:58:46 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.824594326@rscernix>
  8. References: <31249363.1664@ivab.se>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <31249363.1664@ivab.se> Goran_Wireen@ivab.se (Goran Wireen) writes:
  13.  
  14. >I would like to use the same Makefile for different compilers 
  15. >(Gnu C/C++, Unix cc, CXX). I was hoping that I easily could 
  16. >select compiler by calling e.g:
  17. >
  18. >  make gcc all
  19. >
  20. >and by using a Makefile that looks something like this:
  21. >
  22. >  # Default compiler is cc
  23. >  CC = cc
  24. >
  25. >  cxx:
  26. >    CC = cxx
  27. >
  28. >  gcc:
  29. >    CC = gcc
  30. >
  31. >  all:
  32. >    $(CC) $(CFLAGS_AND_STUFF) $(SOURCES) ...
  33. >
  34. >But as you can assign macros in the command lines below cxx: and 
  35. >gcc: this won't work.
  36. >
  37. >Does anybody have any idea how I can select compiler in a simple 
  38. >way?
  39.  
  40. The simplest way I can think of is:
  41.  
  42.     make CC=gcc all
  43.  
  44. Dan
  45. --
  46. Dan Pop
  47. CERN, CN Division
  48. Email: danpop@mail.cern.ch 
  49. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  50.